package com.example.paopao.consumer.worker.controller;

import com.example.paopao.common.web.JsonResult;
import com.example.paopao.consumer.worker.pojo.vo.BusinessVO;
import com.example.paopao.consumer.worker.service.IBusinessService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/v1/workers/")
public class BusinessController {
    @Autowired
    private IBusinessService service;

    @GetMapping("list")
    public JsonResult list(){
        List<BusinessVO> list = service.list();
//        [操作工, 学徒工, 库管员, 工厂搬运工], district=[4, 54, 532], presentDistrict=[2, 52, 502], indetail=北京市 / 北京 / 海淀区, phone=120, proment=大工, salary=12000.0, setmethod=月结, termValue=长短皆可, content=<p>HelloWolr</p>, imageUrl=[/2023/10/06/819e53d6-1fe3-4a47-afbf-f4e778654bbe.png, /2023/10/06/9be04508-b727-4dc2-bf18-2c532a7bcb22.jpg], experience=[{textareas=去年搬过砖, startTime=2023-09-25T16:00:00.000Z, endTime=2023-10-05T16:00:00.000Z}, {textareas=今年刚喝水, startTime=2023-10-02T16:00:00.000Z, endTime=2023-10-06T16:00:00.000Z}])
        return JsonResult.ok(list);
    }

    @GetMapping("{wd}/search")
    public JsonResult search(@PathVariable String wd){
        log.info("搜索：",wd);
        List<BusinessVO> list = service.searchByWd(wd);

        return JsonResult.ok(list);
    }
}
